﻿import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQml 2.15
import Qt.labs.platform 1.1
import FluentUI 1.0

FluWindow {
    id:window
    minimumHeight: 550
    minimumWidth: 1100
    launchMode: FluWindowType.SingleInstance
    fitsAppBarWindows: true
    appBar: FluAppBar {
        height: 30
        showDark: true
        darkClickListener:(button)=>changeDark()
        z:7
    }
    Item{
        id:flipable
        anchors.fill: parent
        //右侧菜单Menu
        RightMenu {
            id:menu
        }
        //右侧导航Footer
        RightMenuFooter{
            id:footer
        }
        Component.onDestruction: {
            FluRouter.exit()
        }
        Item{
            id:page_front
            visible: true
            anchors.fill: flipable
            FluNavigationView{
                property int clickCount: 0
                cellHeight: 40
                cellWidth: 210
                id:nav_view
                width: parent.width
                height: parent.height
                pageMode: FluNavigationViewType.Stack
                footerItems: footer
                displayMode: FluTheme.nativeViewType
                z:999
                items: menu
                title:qsTr("国网中电调试软件")
                logo: "qrc:/logo.ico"
                Component.onCompleted: {
                    menu.navigationView = nav_view
                    footer.navigationView = nav_view
                    setCurrentIndex(0)
                }
            }
        }
    }
    function changeDark(){
        if(FluTheme.dark){
            SettingsHelper.saveDarkMode(1)
            FluTheme.darkMode = FluThemeType.Light
        }else{
            SettingsHelper.saveDarkMode(2)
            FluTheme.darkMode = FluThemeType.Dark
        }
    }
}
